package com.gears_software.sxdc.dccx.ui.util;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;
import com.gears_software.sxdc.dccx.data.model.Seat;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by SunMuran on 2017/8/3.
 */

public class ShowGender {
    private OptionsPickerView gender;
    private List<Seat> genderItem = new ArrayList<>();

    public void initGender(Context context, final TextView tv) {
        getGender();
        gender = new OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = genderItem.get(options1).getPickerViewText();

                tv.setText(tx);
            }
        })
                .build();

        gender.setPicker(genderItem);//添加数据源
    }

    private void getGender() {
        genderItem.add(new Seat(1, "男"));
        genderItem.add(new Seat(1, "女"));

    }

    public void showGender() {
        gender.show();
    }
}
